/**
 * Copyright (c) 2021-2024 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef PLUGINS_ECMASCRIPT_COMPILER_OPTIMIZER_IR_BUILDER_ECMASCRIPT_INST_BUILDER_H
#define PLUGINS_ECMASCRIPT_COMPILER_OPTIMIZER_IR_BUILDER_ECMASCRIPT_INST_BUILDER_H

void BuildEcma([[maybe_unused]] const BytecodeInstruction *bcInst);
template <bool WITH_SPECULATIVE = false>
void BuildEcmaAsIntrinsics([[maybe_unused]] const BytecodeInstruction *bcInst);
void BuildEcmaFromIrtoc([[maybe_unused]] const BytecodeInstruction *bcInst);
template <bool IS_ACC_READ>
void BuildStGlobalVar(const BytecodeInstruction *bcInst, uint32_t typeId);
template <bool IS_ACC_WRITE>
void BuildLdGlobalVar(const BytecodeInstruction *bcInst, uint32_t typeId);

void BuildStObjByIndex(const BytecodeInstruction *bcInst, uint64_t imm);
void BuildLdObjByIndex(const BytecodeInstruction *bcInst, uint64_t imm);

void BuildLdStObjByIndex(const BytecodeInstruction *bcInst, Inst *objInst, uint64_t imm, Inst *storeDef);
void BuildEcmaFnCall(const BytecodeInstruction *bcInst, bool isRange, bool callThis, uint64_t numArgs = 0);
void FinalizeEcmaFnCall(SaveStateInst *saveState, CallInst *callInst);

void BuildEcmaNewobjdynrange(const BytecodeInstruction *bcInst);
void BuildEcmaGetunmappedargs(const BytecodeInstruction *bcInst);

#endif  // PLUGINS_ECMASCRIPT_COMPILER_OPTIMIZER_IR_BUILDER_ECMASCRIPT_INST_BUILDER_H
